home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
source
/
tifreadr.sit
/
Tiff Window DEMO
/
menu selection.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-02-15
|
2KB
|
86 lines
#include "my color.h"
/*Execute Item specified by mResult, the result of MenuSelect*/
DoCommand(mResult)
long mResult;
{
short theItem; /*menu item number from mResult low-order word*/
short theMenu; /*menu number from mResult high-order word*/
char name[256]; /*desk accessory name*/
theItem = LoWord(mResult); /*call Toolbox Utility routines to set */
theMenu = HiWord(mResult); /* menu item number and menu number*/
switch (theMenu) /*switch on menu ID*/
{
case appleID:
if (theItem == aboutItem)
DoAboutBox();
else
{
GetItem(myMenus[appleM],theItem,name);
/*GetPort (&savedPort);*/
scrapErr = ZeroScrap();
(void) OpenDeskAcc(name);
EnableItem (myMenus [editM],0);
/*SetPort (savedPort);*/
if (FrontWindow() != nil)
{
EnableItem (myMenus [fileM], closeItem);
EnableItem (myMenus [editM], undoItem);
} /*if FrontWindow*/
menusOK = false;
} /*if theItem...else*/
break;
case fileID:
switch (theItem)
{
case newItem:
OpenWindow();
break;
case closeItem:
if (((CWindowPeek)FrontWindow())->windowKind < 0)
CloseDeskAcc(((CWindowPeek)FrontWindow())->windowKind);
/*if desk acc window, close it*/
else
KillWindow(FrontWindow());
/*if it's one of mine, blow it away*/
break;
case quitItem:
doneFlag = true; /*quit*/
break;
} /*switch theItem*/
break;
case editID:
if (!SystemEdit(theItem-1))
switch (theItem) /*switch on menu item number*/
{
case cutItem:
break;
case copyItem:
break;
case pasteItem:
break;
case clearItem:
break;
} /*switch theItem*/
break;
case colorID:
change_color(theItem, (CWindowPtr)FrontWindow());
break;
case controlID:
change_control_color(theItem, (CWindowPtr)FrontWindow());
break;
} /*switch theMenu*/
HiliteMenu(0);
} /*DoCommand*/